Delete Publication: "the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission"

OS: Windows Server 2008 SP2.

MS SQL Server 10.0.1600.22

I am the administrator of the computer and of the SQL Server, also the owner of the database.

I have installed a local Publication.

For whatever reason I need to delete it from this server.

I tried with right-click Delete and with Disable Publishing and Distribution. The same result:

TITLE: Microsoft.SqlServer.ConnectionInfo

SQL Server could not disable publishing and distribution on <computer-name>\<sqlServerName>.

ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.

Changed database context to 'master'. (Microsoft SQL Server, Error: 15517)

I also tried:

exec sp_removedbreplication N'<sqlServerName>'

exec sp_droppublication @publication = N'<sqlServerName>'

exec sp_changedbowner @loginame = 'sa'

What exactly is the meaning of: because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission. ?

Because in fact dbo exists and my account has dbo permissions.

Thank you very much,

Dan

December 9th, 2009 7:00pm

Hi !

Was the database restored form the other server ??
This problem occurs because SQL Server 2005 cannot obtain the information about the context when you try to impersonate a database user to run a statement or a module.

SQL Server cannot obtain the information about the context that you are trying to impersonate under the conditions that are listed in the "Symptoms" section. If you impersonate a SQL Server authorization login, SQL Server cannot find a login that matches the security identifier (SID) of the impersonated user. If you impersonate a domain user, the domain controller cannot find the information about the specific user who matches the SID of the impersonated user.


ALTER AUTHORIZATION ON DATABASENAME TO Loginname
http://support.microsoft.com/default.aspx/kb/913423
---------- THANKS,Suhas V
  • Proposed as answer by Serge Sidoroff Friday, February 01, 2013 6:38 AM
Free Windows Admin Tool Kit Click here and download it now
December 9th, 2009 7:23pm

Thank you very much Suhas.

This SQL server is 2008.
The DB has been copied from a 2005 SQL server and works as expected.
As seen in my first post I had applied KB913423 and had got the message:
"Cannot find the principal '<new user>', because it does not exist or you do not have permission."
Of course, the <new user> exists

Although in my opinion I have all possible permissions, what permission is referred to in these error messages?

Thanks again,
Dan
December 9th, 2009 8:00pm

This issue is because of the database move .Can you please check out wether the owner is a valid sql login & please change the owner of the database to valid login ! ALTER AUTHORIZATION ON DATABASENAME TO <Loginname>
------------ Thanks,Suhas V
Free Windows Admin Tool Kit Click here and download it now
December 9th, 2009 8:18pm

Actually the user is a Role Member of the Owner dbo, with owned schemas dbo and db_owner.
In the ALTER AUTHORIZATION line (ALTER AUTHORIZATION ON irismaster TO 'EUR-ENT-001\wa2') I use the login name exactly at it is under Security|Logins but I get a syntax error: "Expecting SCHEMA, ID, or Quoted_ID".

Thanks again,
Dan
December 9th, 2009 8:49pm

Dan ,
syntax was wrong in the previous instance ! can you check with the following :ALTER AUTHORIZATION ON DATABASE::[databasename] TO [loginname];

------------- Thanks,Suhas V
  • Marked as answer by Dan1 Thursday, December 10, 2009 8:17 AM
Free Windows Admin Tool Kit Click here and download it now
December 10th, 2009 6:13am

The syntax error message "Expecting SCHEMA, ID, or Quoted_ID" was referring the login name: the correct syntax uses "" or nothing; I had used ' '.
Then, the only login name accepted was sa. This one solved the problem.

Thank you very much Suhas.
  • Marked as answer by Dan1 Thursday, December 10, 2009 8:22 AM
December 10th, 2009 8:22am

fire the following query: select name, suser_sname(owner_sid) from sys.databases see that there is no null for the suser_sname(owner_sid) field. Also see that the distributor database and the publisher database both have the same owner_sid values. In either of the above cases, fire this : ALTER AUTHORIZATION ON DATABASE::[<dbname>] TO sa where dbname would be for the publisher or distributor database as the case may be. I have tested this on an error giving replication instance and this worked well to resolve the 15517 error.
Free Windows Admin Tool Kit Click here and download it now
June 2nd, 2010 12:16pm

Thanks for this tip...saved me hours!
  • Proposed as answer by TFAHY Friday, June 17, 2011 3:02 AM
  • Unproposed as answer by TFAHY Friday, June 17, 2011 3:02 AM
July 22nd, 2010 2:40pm

I had the same problem but then i realised the database didn't have an owner so when i logged in (as any account) I was not able to alter the owner using a query. So I logged in as SA right clicked the database ->properties->files->...(2nd setting) and assigned the owner to SA. Now its sorted!
  • Proposed as answer by Faiz Ullah Wednesday, June 22, 2011 3:52 AM
Free Windows Admin Tool Kit Click here and download it now
June 17th, 2011 3:05am

John, Thanks so much for your answer. It really helped me out!
August 6th, 2011 4:31am

Thanks alot Suhas and John

It was wonderful knowledge sharing and very appriciable for the RD made by you 2.

It has also helepd me alot and saved my time.

Free Windows Admin Tool Kit Click here and download it now
January 12th, 2012 6:12am

Thanks alot Suhas and John

very good...

January 30th, 2012 7:12am

thank you ..

this is very useful to me..


Free Windows Admin Tool Kit Click here and download it now
October 23rd, 2012 6:02am

Running this statement as per John's advice worked for me also:

ALTER AUTHORIZATION ON DATABASE::[<dbname>] TO sa

June 21st, 2015 9:58pm

Yes changing to SA  will resolve the issue.
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2015 12:13am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics